package com.schoolgard.entitybean;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Device entity. 
 * @author luoyegang
 */
@Entity
@Table(name = "DEVICE")
public class Device implements java.io.Serializable {

	private static final long serialVersionUID = 201203101107L;
	private String guid;
	private Params params;
	private Organization organization;
	private HdType hdType;
	private String name;
	private String parentDeviceGuid;
	private String domain;
	private String maintainStatus;
	private Boolean rooter;
	private String serial;

	//	private Set<Terminal> terminals = new HashSet<Terminal>(0);
	/*private Set<ParamServer> paramServers = new HashSet<ParamServer>(0);*/
	@Column(name = "SERIAL")
	public String getSerial() {
		return serial;
	}

	public void setSerial(String serial) {
		this.serial = serial;
	}

	@Id
	@Column(name = "GUID", unique = true, nullable = false, length = 64)
	public String getGuid() {
		return this.guid;
	}

	public void setGuid(String guid) {
		this.guid = guid;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "PARAMS_ID", nullable = false)
	public Params getParams() {
		return this.params;
	}

	public void setParams(Params params) {
		this.params = params;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ORGANIZATION_ID", nullable = false)
	public Organization getOrganization() {
		return this.organization;
	}

	public void setOrganization(Organization organization) {
		this.organization = organization;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "HD_TYPE_ID", nullable = false)
	public HdType getHdType() {
		return this.hdType;
	}

	public void setHdType(HdType hdType) {
		this.hdType = hdType;
	}

	@Column(name = "NAME", length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "PARENT_DEVICE_GUID", length = 64)
	public String getParentDeviceGuid() {
		return this.parentDeviceGuid;
	}

	public void setParentDeviceGuid(String parentDeviceGuid) {
		this.parentDeviceGuid = parentDeviceGuid;
	}

	@Column(name = "DOMAIN", length = 256)
	public String getDomain() {
		return this.domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	@Column(name = "MAINTAIN_STATUS")
	public String getMaintainStatus() {
		return this.maintainStatus;
	}

	public void setMaintainStatus(String maintainStatus) {
		this.maintainStatus = maintainStatus;
	}

	@Column(name = "ROOTER", precision = 1, scale = 0)
	public Boolean getRooter() {
		return this.rooter;
	}

	public void setRooter(Boolean rooter) {
		this.rooter = rooter;
	}

	/*@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "device")
	public Set<Terminal> getTerminals() {
		return this.terminals;
	}

	public void setTerminals(Set<Terminal> terminals) {
		this.terminals = terminals;
	}*/

	/*@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "device")
	public Set<ParamServer> getParamServers() {
		return this.paramServers;
	}

	public void setParamServers(Set<ParamServer> paramServers) {
		this.paramServers = paramServers;
	}*/

}